/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Entities;
//classe modifiée par nabila
import java.io.Serializable;
import java.util.Collection;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Dell
 */
@Entity
@Table(name = "modelerdp")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Modelerdp.findAll", query = "SELECT m FROM Modelerdp m"),
    @NamedQuery(name = "Modelerdp.findByIdm", query = "SELECT m FROM Modelerdp m WHERE m.idm = :idm"),
    @NamedQuery(name = "Modelerdp.findByDatec", query = "SELECT m FROM Modelerdp m WHERE m.datec = :datec"),
    @NamedQuery(name = "Modelerdp.findByMatricepre", query = "SELECT m FROM Modelerdp m WHERE m.matricepre = :matricepre"),
    @NamedQuery(name = "Modelerdp.findByMatricepost", query = "SELECT m FROM Modelerdp m WHERE m.matricepost = :matricepost")})
//changement ines
public class Modelerdp implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 15)
    @Column(name = "idm")
    private String idm;
    @Basic(optional = false)
    @NotNull
    @Column(name = "datec")
    @Temporal(TemporalType.TIMESTAMP)
    private Date datec;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 100)
    @Column(name = "matricepre")
    private String matricepre;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 100)
    @Column(name = "matricepost")
    private String matricepost;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idm")
    private Collection<Marquage> marquageCollection;
    @JoinColumn(name = "login", referencedColumnName = "login")
    @ManyToOne(optional = false)
    private Utilisateur login;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idm")
    private Collection<Trace> traceCollection;

    public Modelerdp() {
    }

    public Modelerdp(String idm) {
        this.idm = idm;
    }

    public Modelerdp(String idm, Date datec, String matricepre, String matricepost) {
        this.idm = idm;
        this.datec = datec;
        this.matricepre = matricepre;
        this.matricepost = matricepost;
    }

    public String getIdm() {
        return idm;
    }

    public void setIdm(String idm) {
        this.idm = idm;
    }

    public Date getDatec() {
        return datec;
    }

    public void setDatec(Date datec) {
        this.datec = datec;
    }

    public String getMatricepre() {
        return matricepre;
    }

    public void setMatricepre(String matricepre) {
        this.matricepre = matricepre;
    }

    public String getMatricepost() {
        return matricepost;
    }

    public void setMatricepost(String matricepost) {
        this.matricepost = matricepost;
    }

    @XmlTransient
    public Collection<Marquage> getMarquageCollection() {
        return marquageCollection;
    }

    public void setMarquageCollection(Collection<Marquage> marquageCollection) {
        this.marquageCollection = marquageCollection;
    }

    public Utilisateur getLogin() {
        return login;
    }

    public void setLogin(Utilisateur login) {
        this.login = login;
    }

    @XmlTransient
    public Collection<Trace> getTraceCollection() {
        return traceCollection;
    }

    public void setTraceCollection(Collection<Trace> traceCollection) {
        this.traceCollection = traceCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idm != null ? idm.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Modelerdp)) {
            return false;
        }
        Modelerdp other = (Modelerdp) object;
        if ((this.idm == null && other.idm != null) || (this.idm != null && !this.idm.equals(other.idm))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "" + idm + "";
    }
    
}
